#pragma once

#include <list> 
#include "MySqlConn.h"
#include "utils/CSingletonT.h"
#include "utils/Mutex.h"

namespace db 
{

class MySqlConnPool : public utils::CSingletonT<MySqlConnPool> 
{
public:
    MySqlConnPool();
    ~MySqlConnPool();
    bool init(const std::string& strFile);
    MySqlConn::ptr getConn();
    bool parseFromJson(const std::string& strFile);

private:
    MySqlConf::ptr m_ptrConf; 
    std::list<MySqlConn*> m_listConns;
    utils::Mutex m_mutex;
    size_t m_nMaxSize;
};
    
} // namespace db 